<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="../../../commons/taglib.jsp" %>
<%@ page import="java.text.SimpleDateFormat" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN"><head>
  
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <title>入库新增</title>
 
	<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" href="${ctx}/static/js/bootstrap.min/css/bootstrap.css" type="text/css">
    <link rel="stylesheet" href="${ctx}/static/js/bootstrap.min/css/bootstrap-theme.css" type="text/css">
	

	<link rel="stylesheet" type="text/css" href="common/ymPrompt4/skin/qq/ymPrompt.css">
	<link rel="stylesheet" href="${ctx}/static/css/pintuer.css">
    <link rel="stylesheet" href="${ctx}/static/css/admin.css">
    <link rel="stylesheet" href="${ctx}/static/css/bootstrap.min.css">
    <script src="${ctx}/static/js/jquery.js"></script>
    <script src="${ctx}/static/js/pintuer.js"></script>
	<script src="${ctx}/static/js/bootstrap.min/js/bootstrap.min.js"></script>
	<script src="${ctx}/static/js/bootstrap.min/js/jquery-1.11.1.min.js"></script>
	<script src="${ctx}/static/js/bootstrap.min/js/bootstrap.js"></script>
   
   <style>
   .table-hover > tbody > tr:hover {
	  background-color: #e8e8e8;
	}
   .btn-default:hover {
	  color: #FFFFFF;
	  background-color: #009FA6;
	  border-color: #009FA6;
	}
	.pagination {
	  display: inline;
	  padding-left: 0;
	  margin: 10px 0;
	  border-radius: 4px;
	}
 
	.pagination > li > a:hover,
	.pagination > li > span:hover,
	.pagination > li > a:focus,
	.pagination > li > span:focus {
	  z-index: 3;
	  color: #FFFFFF;
	  background-color: #259696;
	  border-color: #259696;
	}
	.select-focus {
	background: #eee;
}
.has-success .form-control {
padding:0px;
   border-color: #66afe9;/*输入框  边框颜色 */
  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
          box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
}
.has-success .form-control:focus {
  border-color: #66afe9;/*点击时输入的边框色*/
  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #66afe9;
          box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #66afe9;/*点击时输入的边框色边外色*/
}
.input-group {    width: 100%;
}
.has-success .input-group-addon { 
  color: #000000;/* 字体颜色*/
  background-color: #CCECED;
  border-color: #CCECED;/*边框颜色*/  
  width: 83px;}  
.form-control[readonly]
	{
	color:#080808;
	background-color:#CCECED ;
	}
.input-group-addon
{
color:#080808;
background-color:#CCECED ;
}

.fix-div {
    position: fixed;
    top: 0px;
}
#info_sxrq[readonly]
{
	color:#080808;
	background-color:#FFFFFF ;
}

   </style>  
    
  </head>
  <body>
<!-- ajax提交等待层 -->
<div id="ajaxwaiting" style="top:0px;left:0px;position: fixed;width:100%;height:100%;z-index:9999;display:none;">
<div style="display:table;text-align:center;width:100%;height:100%;background-color:#000;opacity:0.55; filter:alpha(opacity=55);">
	<span style="display:table-cell;vertical-align:middle;"><img src="zh-cn/common/img/loading.gif"></span>
	</div>
</div>	
	<form id="infoform" name="infoform" > 	 		
   <table class="table" id="table">
	  <tbody><tr>
		<td>
			<span style="font-size:14px;"><a href="javascript:history.go(-1);" class="btn btn-link" style="color:#38B7B7">&lt; 返回上一级</a>|&nbsp;&nbsp;入库新增
			<span style="float:right;">
				<a class="btn btn-link" href="shenhe" style="color:#009FA6;">供货单位定义</a>				
				<a href="zy_medicine"><button type="button" class="btn btn-default" onclick="push()" style="width:80px;">刷新</button></a>
			</span></span>
		</td>
	  </tr>
	  <tr id="tjdj">
	   <td colspan="5">
		
		 <table class="table-condensed" id="table1">
		   <tbody><tr>
		    <td>
				<div class="input-group has-success">
					<span class="input-group-addon">供货单位 :</span>
					
					<select class="form-control" style="padding: 0px;height: 30px;" id="unit_gysid" name="Supply_unit_id">
						<c:forEach items="${name_dw}" var="list">
							<option value="${list.id}" >${list. company_name}</option>	
						</c:forEach>							
					</select>
					
				</div>
		     </td>
		     <td>
				<div class="input-group has-success">
					<span class="input-group-addon">经办人员 :</span> 
					<input type="text" class="form-control input-sm" id="jbry" name="ad_name" value="${username }" readonly="">						
				</div>							
		     </td>
		     <td>
				<div class="input-group has-success">
					<span class="input-group-addon">收到日期 :</span> <input type="text" class="form-control input-sm" id="unit_rcrq" name="sc_date" value="${Date}" style="margin: 0;padding: 0;">								
				</div>							
		     </td>
		     
		     <td>
				<div class="input-group has-success">
					<span class="input-group-addon">入库日期 :</span> 
					<input style="margin: 0;padding: 0;" type="text" class="form-control input-sm" id="unit_shrq" name="rk_date" value="${Date}" aria-describedby="inputGroupSuccess3Status">
					
				</div>
		     </td>
		     <td>
		     	<a type="button" style="width:85px;margin-left: 10px;" class="btn btn-sm btn-default" id="shouqitianjia" onclick="shouqi()">隐藏明细</a>
		     </td>
		  </tr>			
		</tbody></table>
		
		</td>
	  </tr>
	  <tr id="tjmx">
		<td colspan="4">
		
		
				<table class="table-condensed" id="table2" style="width: 100%;">
			<tbody>
			
			<tr>
				<td>
					<div class="input-group has-success has-feedback">
							<span class="input-group-addon">药&nbsp;品&nbsp;&nbsp;I&nbsp;D</span>
							<input type="text" class="form-control input-sm" placeholder="输入名称或ID" id="bh" name="bh" data-toggle="modal" value="" title="请输入：1数字码.2药品五笔码.3药品拼音码 .4药品名称" aria-describedby="inputGroupSuccess3Status" >
							<a class="button border-main" href="JavaScript:;" onclick="nmx()"> 查询</a>
					</div>													
				</td>
				<td>
					<div class="input-group has-success">
						<span class="input-group-addon">名&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称</span> 
						<input type="text" class="form-control input-sm" id="info_ypmc" name="name" value="" aria-describedby="inputGroupSuccess3Status" readonly="">
					</div>					
				</td>
				<td>
					<div class="input-group has-success">
						<span class="input-group-addon">规 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;格</span> 
						<input type="text" class="form-control input-sm" id="info_gg" name="spec" value="" aria-describedby="inputGroupSuccess3Status" readonly="">
					</div>
				</td>
				<td>
					<div class="input-group has-success">
						<span class="input-group-addon">单&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;位</span> 
						<input type="text" class="form-control input-sm" id="info_dw" name="unit" value="" aria-describedby="inputGroupSuccess3Status" readonly="">
					</div>
				</td>
				<td>
					<div class="input-group has-success">
						<span class="input-group-addon">价格类别</span> 
						<input type="text" class="form-control input-sm" id="info_jglb" name="jb" aria-describedby="inputGroupSuccess3Status" readonly="">
					</div>				
				</td>
			</tr>
			<tr>
				<td>
					<div class="input-group has-success">
						<span class="input-group-addon">进&nbsp;&nbsp;货&nbsp;&nbsp;量</span> 
						<input type="text" class="form-control input-sm" onkeydown="if(event.keyCode==13)HCfocus('info_ypjhj')" id="unit_rcsl" name="tory"  value="" aria-describedby="inputGroupSuccess3Status" required="required">
					</div>
				</td>
				<td>
					<div class="input-group has-success">
						<span class="input-group-addon">批&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;次</span> 
						<input type="text" class="form-control input-sm" id="info_pc" name="batch" value="" aria-describedby="inputGroupSuccess3Status" readonly="" readOnly="true">
					</div>
				</td>
				<td>
					<div class="input-group has-success">
						<span class="input-group-addon">库存数量</span>
						 <input type="text" class="form-control input-sm" id="info_kcsl"  value="" aria-describedby="inputGroupSuccess3Status" readonly="">
					</div>											
				</td>
				<td>
					<div class="input-group has-success">
						<span class="input-group-addon">加&nbsp;&nbsp;成&nbsp;&nbsp;率</span> 
						<input type="text" class="form-control input-sm" id="info_jcl"  value="1.15" aria-describedby="inputGroupSuccess3Status" readonly="">
					</div>
				</td>
				<td>
					<div class="input-group has-success">
						<span class="input-group-addon">批&nbsp;&nbsp;发&nbsp;&nbsp;价</span>
						 <input type="text" class="form-control input-sm" id="info_yppfj" name="p_price" value="" style="color:#FF0000;" aria-describedby="inputGroupSuccess3Status" readonly="">
					</div>
				</td>
								
			</tr>
			<tr>
							
				<td>
					<div class="input-group has-success">
						<span class="input-group-addon">进&nbsp;&nbsp;货&nbsp;&nbsp;价</span> 
						<input type="text" class="form-control input-sm" onkeydown="if(event.keyCode==13)Jhjfocus('info_yplsj')" id="info_ypjhj" name="info_ypjhj" value="" style="color:#FF0000;" aria-describedby="inputGroupSuccess3Status" onkeyup="ZNSRSZ4(this)">
					</div>					
				</td>
				<td>
					<div class="input-group has-success">
						<span class="input-group-addon">零&nbsp;&nbsp;售&nbsp;&nbsp;价</span> 
						<input type="text" class="form-control input-sm" onkeydown="if(event.keyCode==13)HCfocus('info_cd')" id="info_yplsj" name="price" value="" style="color:#FF0000;" aria-describedby="inputGroupSuccess3Status" readonly="">
					</div>			
				</td>
				<td>
					<div class="input-group has-success">
						<span class="input-group-addon">产&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;地</span> 
						<input type="text" class="form-control input-sm" id="info_cd" name="region" onkeydown="if(event.keyCode==13)HCfocus('info_pzwh')" value="" aria-describedby="inputGroupSuccess3Status" required="required">
					</div>
				</td>
				<td>
					<div class="input-group has-success">
						<span class="input-group-addon">准&nbsp;&nbsp;字&nbsp;&nbsp;号</span> 
						<input type="text" class="form-control input-sm" id="info_pzwh" name="info_pzwh" onkeydown="if(event.keyCode==13)HCfocus('info_ph')" value="" aria-describedby="inputGroupSuccess3Status" required="required">
					</div>
				</td>
				<td>
					<div class="input-group has-success">
						<span class="input-group-addon">科&nbsp;&nbsp;室&nbsp;&nbsp;号</span> 
						<input type="text" class="form-control input-sm" id="info_ph" name="department_id" onkeydown="if(event.keyCode==13)HCfocus('info_sxrq')" value="" aria-describedby="inputGroupSuccess3Status" required="required"> 
					</div>
				</td>
			</tr>
			<tr> 
				<td>
					<div class="input-group has-success">
						<span class="input-group-addon">有&nbsp;&nbsp;效&nbsp;&nbsp;期</span> 
						<input type="date"onkeydown="if(event.keyCode==13){HCfocus('info_fph')}else{ZNSRSZ5(this);}" onblur="check()" class="form-control input-sm" id="info_sxrq" name="yx_date" value="" aria-describedby="inputGroupSuccess3Status" required="required">
					</div>					
				</td>
				<td>
					<div class="input-group has-success">
						<span class="input-group-addon">发&nbsp;&nbsp;票&nbsp;&nbsp;号</span>
						 <input type="text" class="form-control input-sm" id="info_fph" name="fpnumber" value="" onkeydown="if(event.keyCode==13)HCfocus('info_bz')" aria-describedby="inputGroupSuccess3Status" required="required">
					</div>
				</td>
				<td colspan="3">
				<table>
				<tbody><tr>
				<td>
					<div class="input-group has-success" style="width:455px">
						<span class="input-group-addon">备 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注</span>
						 <input style="width: 370px;" type="text" class="form-control input-sm" id="info_bz" name="bz" onkeydown="if(event.keyCode==13)BZHCSJ()" value="" aria-describedby="inputGroupSuccess3Status" required="required">
					</div>						
				</td>
				<td>
				<input type="hidden" id="info_aid" name="info.aid" value="">
				<input type="hidden" id="unit_aid" name="unit.aid" value="">
				<input type="hidden" id="djzt" name="djzt" value="">
				<input type="hidden" id="djbh" name="djbh" value="">
				<input type="hidden" id="info_ggid" name="info.ggid" value="">
				<input type="hidden" id="djxxid" name="djxxid" value="">
				<input type="hidden" id="djmxid" name="djmxid" value="">
				<input type="hidden" id="aid" name="aid" value="">
				<input type="hidden" id="qdbz" name="qdbz" value=""> 		
				<input type="hidden" id="yplb" name="yplb" value=""> 
				<input type="hidden" id="ypjhj" name="ypjhj" value=""> 	
				<input type="hidden" id="info_rcksid" name="info.rcksid" value="">					 
				<button type="button" style="width:85px;margin-left: 10px;" class="btn btn-sm btn-default"  id="querkbtn" onclick="zj()">添加</button>
				</td>
				</tr>
				</tbody></table>
				</td>
			</tr>
			
		  </tbody>
		  </table>	
				
			
		  
		 
		
		</td>
	  </tr>
	  <tr>
	  	<td>
	  	 	<table class="table table-hover">
	  	 		<thead>
		  	 	  <tr style="background-color:#CCECED;">
		  	 	 		<th>操作</th>
						<th>单据编号</th>
						<th>药品名称</th>
						<th>规格</th>
						<th>入库数量</th>
						<th>单位</th>
						<th>批次</th>
						<th>进货价</th>
						<th>零售价</th>
						<th>入库科室</th>					
		  		  </tr>
	  		 	 </thead>
	  		 	 <c:forEach items="${Drug}" var="list">
	  		 		<tr>
						<td><a class="button border-main" href="JavaScript:;" onclick="sc(${list.id})">删除</a></td>
						<td>${list.id}</td>
						<td>${list.name}</td>
						<td>${list.spec}</td>
						<td>${list.tory}</td>
						<td>${list.unit}</td>
						<td>${list.batch}</td>
						<td>${list.p_price}</td>
						<td>${list.price}</td>
						<td>${list.d_name}</td>
	  		 	 	</tr>
	  		 	 </c:forEach>
	  		 	 <tfoot>
		  		  <tr>
		  		  	<td colspan="12">
   						 <div id="callBackPager"></div>
		  		  	</td>
		  		  </tr>
	  		  </tfoot>
	  	 	</table>
	  	</td>
	  </tr>
   </tbody>
   </table>
   </form>
  <div class="modal fade" id="SHCKMNTK" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog" style="width: 420px;">
			<div class="modal-content">
				<div class="modal-header" style="background-color: #CCECED;">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
					<h4 class="modal-title" id="title" style="text-align: center;">
						出库科室</h4>
				</div>
				<div class="modal-body" id="TKDIV">
					<input type="hidden" id="CKAID">
					<div class="form-group">
						<div class="input-group">
							<span class="input-group-addon" style="background-color: #FFFFFF;">选择科室</span> <select class="form-control" id="CKKSSID" name="CKKSSID">
							</select>
						</div>
					</div>
				</div>
				<div class="modal-footer" style="text-align: center;">
					<button type="button" class="btn btn-default" onclick="Fhsyj()">关闭
					</button>
					<button type="button" class="btn btn-primary" onclick="SHCKSAVE()">
						提交更改</button>
				</div>
			</div>
		</div>
	</div> 
	<div style="display: none;">
   <select id="xtcsjcl">
   
   
   <option value="1.20">_CLMRJCL</option>
   
   <option value="1.15">_XYMRJCL</option>
   
   <option value="1.15">_ZCYMRJCL</option>
   
   <option value="1.30">_ZYMRJCL</option>
   
   
   </select>
   </div>
   
    <!-- 模态框（Modal）2 -->
	<div class="modal fade bs-example-modal-lg" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	  <div class="modal-dialog modal-lg" role="document">
	    <div class="modal-content">
	      <div class="modal-header" style="background-color:#CCECED;">
	        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
	        <span aria-hidden="true"></span>
	        </button>
	        <h4 class="modal-title" id="myModalLabel" style="text-align:center;">药品品种选择(入库)</h4>
	      </div>
	      <div class="modal-body">
	       <div id="111">
	      <div id="table_th">
	    	<table class="table table-hover" style="white-space: nowrap;">
	    	<thead>
				<tr id="column" style="background: #CCECED;">							
					<th>药品编号</th>
					<th>药品名称</th>
					<th>进货价</th>
					<th>零售价</th>
					<th>批次</th>
					<th>规格</th>
					<th>单位</th>
					<th>产地</th>
					<th>库存数量</th>
					<th>药价级别</th>
					<th style="width: 17px;" id="GDTTH"></th>
				</tr>
				</thead>
				</table>
				</div>
				<div id="table_tr" style="max-height: 420px;overflow:auto;margin: -20px 0px 0px;">
				<table id="table_tr_table" class="table table-hover">
					<tbody id="tabc">				
					</tbody>
				</table>
			</div>
			</div>	
	      </div>
	    </div>
	  </div>
	</div><!-- /.modal --> 
   
  	
<div class="datetimepicker datetimepicker-dropdown-bottom-right dropdown-menu" style="left: 719px; z-index: 10009;"><div class="datetimepicker-minutes" style="display: none;"><table class=" table-condensed"><thead><tr><th class="prev" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-left"></span> </th><th colspan="5" class="switch">21 四月 2017</th><th class="next" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-right"></span> </th></tr></thead><tbody><tr><td colspan="7"><span class="minute">13:00</span><span class="minute">13:05</span><span class="minute">13:10</span><span class="minute">13:15</span><span class="minute">13:20</span><span class="minute">13:25</span><span class="minute">13:30</span><span class="minute">13:35</span><span class="minute">13:40</span><span class="minute">13:45</span><span class="minute active">13:50</span><span class="minute">13:55</span></td></tr></tbody><tfoot><tr><th colspan="7" class="today">今天</th></tr><tr><th colspan="7" class="clear" style="display: none;">Clear</th></tr></tfoot></table></div><div class="datetimepicker-hours" style="display: none;"><table class=" table-condensed"><thead><tr><th class="prev" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-left"></span> </th><th colspan="5" class="switch">21 四月 2017</th><th class="next" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-right"></span> </th></tr></thead><tbody><tr><td colspan="7"><span class="hour">0:00</span><span class="hour">1:00</span><span class="hour">2:00</span><span class="hour">3:00</span><span class="hour">4:00</span><span class="hour">5:00</span><span class="hour">6:00</span><span class="hour">7:00</span><span class="hour">8:00</span><span class="hour">9:00</span><span class="hour">10:00</span><span class="hour">11:00</span><span class="hour">12:00</span><span class="hour active">13:00</span><span class="hour">14:00</span><span class="hour">15:00</span><span class="hour">16:00</span><span class="hour">17:00</span><span class="hour">18:00</span><span class="hour">19:00</span><span class="hour">20:00</span><span class="hour">21:00</span><span class="hour">22:00</span><span class="hour">23:00</span></td></tr></tbody><tfoot><tr><th colspan="7" class="today">今天</th></tr><tr><th colspan="7" class="clear" style="display: none;">Clear</th></tr></tfoot></table></div><div class="datetimepicker-days" style="display: block;"><table class=" table-condensed"><thead><tr><th class="prev" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-left"></span> </th><th colspan="5" class="switch">四月 2017</th><th class="next" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-right"></span> </th></tr><tr><th class="dow">日</th><th class="dow">一</th><th class="dow">二</th><th class="dow">三</th><th class="dow">四</th><th class="dow">五</th><th class="dow">六</th></tr></thead><tbody><tr><td class="day old">26</td><td class="day old">27</td><td class="day old">28</td><td class="day old">29</td><td class="day old">30</td><td class="day old">31</td><td class="day">1</td></tr><tr><td class="day">2</td><td class="day">3</td><td class="day">4</td><td class="day">5</td><td class="day">6</td><td class="day">7</td><td class="day">8</td></tr><tr><td class="day">9</td><td class="day">10</td><td class="day">11</td><td class="day">12</td><td class="day">13</td><td class="day">14</td><td class="day">15</td></tr><tr><td class="day">16</td><td class="day">17</td><td class="day">18</td><td class="day">19</td><td class="day">20</td><td class="day today active">21</td><td class="day">22</td></tr><tr><td class="day">23</td><td class="day">24</td><td class="day">25</td><td class="day">26</td><td class="day">27</td><td class="day">28</td><td class="day">29</td></tr><tr><td class="day">30</td><td class="day new">1</td><td class="day new">2</td><td class="day new">3</td><td class="day new">4</td><td class="day new">5</td><td class="day new">6</td></tr></tbody><tfoot><tr><th colspan="7" class="today">今天</th></tr><tr><th colspan="7" class="clear" style="display: none;">Clear</th></tr></tfoot></table></div><div class="datetimepicker-months" style="display: none;"><table class="table-condensed"><thead><tr><th class="prev" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-left"></span> </th><th colspan="5" class="switch">2017</th><th class="next" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-right"></span> </th></tr></thead><tbody><tr><td colspan="7"><span class="month">一月</span><span class="month">二月</span><span class="month">三月</span><span class="month active">四月</span><span class="month">五月</span><span class="month">六月</span><span class="month">七月</span><span class="month">八月</span><span class="month">九月</span><span class="month">十月</span><span class="month">十一月</span><span class="month">十二月</span></td></tr></tbody><tfoot><tr><th colspan="7" class="today">今天</th></tr><tr><th colspan="7" class="clear" style="display: none;">Clear</th></tr></tfoot></table></div><div class="datetimepicker-years" style="display: none;"><table class="table-condensed"><thead><tr><th class="prev" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-left"></span> </th><th colspan="5" class="switch">2010-2019</th><th class="next" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-right"></span> </th></tr></thead><tbody><tr><td colspan="7"><span class="year old">2009</span><span class="year">2010</span><span class="year">2011</span><span class="year">2012</span><span class="year">2013</span><span class="year">2014</span><span class="year">2015</span><span class="year">2016</span><span class="year active">2017</span><span class="year">2018</span><span class="year">2019</span><span class="year old">2020</span></td></tr></tbody><tfoot><tr><th colspan="7" class="today">今天</th></tr><tr><th colspan="7" class="clear" style="display: none;">Clear</th></tr></tfoot></table></div></div><div class="datetimepicker datetimepicker-dropdown-bottom-right dropdown-menu" style="left: 472px; z-index: 10019;"><div class="datetimepicker-minutes" style="display: none;"><table class=" table-condensed"><thead><tr><th class="prev" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-left"></span> </th><th colspan="5" class="switch">21 四月 2017</th><th class="next" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-right"></span> </th></tr></thead><tbody><tr><td colspan="7"><span class="minute">13:00</span><span class="minute">13:05</span><span class="minute">13:10</span><span class="minute">13:15</span><span class="minute">13:20</span><span class="minute">13:25</span><span class="minute">13:30</span><span class="minute">13:35</span><span class="minute">13:40</span><span class="minute">13:45</span><span class="minute active">13:50</span><span class="minute">13:55</span></td></tr></tbody><tfoot><tr><th colspan="7" class="today">今天</th></tr><tr><th colspan="7" class="clear" style="display: none;">Clear</th></tr></tfoot></table></div><div class="datetimepicker-hours" style="display: none;"><table class=" table-condensed"><thead><tr><th class="prev" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-left"></span> </th><th colspan="5" class="switch">21 四月 2017</th><th class="next" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-right"></span> </th></tr></thead><tbody><tr><td colspan="7"><span class="hour">0:00</span><span class="hour">1:00</span><span class="hour">2:00</span><span class="hour">3:00</span><span class="hour">4:00</span><span class="hour">5:00</span><span class="hour">6:00</span><span class="hour">7:00</span><span class="hour">8:00</span><span class="hour">9:00</span><span class="hour">10:00</span><span class="hour">11:00</span><span class="hour">12:00</span><span class="hour active">13:00</span><span class="hour">14:00</span><span class="hour">15:00</span><span class="hour">16:00</span><span class="hour">17:00</span><span class="hour">18:00</span><span class="hour">19:00</span><span class="hour">20:00</span><span class="hour">21:00</span><span class="hour">22:00</span><span class="hour">23:00</span></td></tr></tbody><tfoot><tr><th colspan="7" class="today">今天</th></tr><tr><th colspan="7" class="clear" style="display: none;">Clear</th></tr></tfoot></table></div><div class="datetimepicker-days" style="display: block;"><table class=" table-condensed"><thead><tr><th class="prev" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-left"></span> </th><th colspan="5" class="switch">四月 2017</th><th class="next" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-right"></span> </th></tr><tr><th class="dow">日</th><th class="dow">一</th><th class="dow">二</th><th class="dow">三</th><th class="dow">四</th><th class="dow">五</th><th class="dow">六</th></tr></thead><tbody><tr><td class="day old">26</td><td class="day old">27</td><td class="day old">28</td><td class="day old">29</td><td class="day old">30</td><td class="day old">31</td><td class="day">1</td></tr><tr><td class="day">2</td><td class="day">3</td><td class="day">4</td><td class="day">5</td><td class="day">6</td><td class="day">7</td><td class="day">8</td></tr><tr><td class="day">9</td><td class="day">10</td><td class="day">11</td><td class="day">12</td><td class="day">13</td><td class="day">14</td><td class="day">15</td></tr><tr><td class="day">16</td><td class="day">17</td><td class="day">18</td><td class="day">19</td><td class="day">20</td><td class="day today active">21</td><td class="day">22</td></tr><tr><td class="day">23</td><td class="day">24</td><td class="day">25</td><td class="day">26</td><td class="day">27</td><td class="day">28</td><td class="day">29</td></tr><tr><td class="day">30</td><td class="day new">1</td><td class="day new">2</td><td class="day new">3</td><td class="day new">4</td><td class="day new">5</td><td class="day new">6</td></tr></tbody><tfoot><tr><th colspan="7" class="today">今天</th></tr><tr><th colspan="7" class="clear" style="display: none;">Clear</th></tr></tfoot></table></div><div class="datetimepicker-months" style="display: none;"><table class="table-condensed"><thead><tr><th class="prev" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-left"></span> </th><th colspan="5" class="switch">2017</th><th class="next" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-right"></span> </th></tr></thead><tbody><tr><td colspan="7"><span class="month">一月</span><span class="month">二月</span><span class="month">三月</span><span class="month active">四月</span><span class="month">五月</span><span class="month">六月</span><span class="month">七月</span><span class="month">八月</span><span class="month">九月</span><span class="month">十月</span><span class="month">十一月</span><span class="month">十二月</span></td></tr></tbody><tfoot><tr><th colspan="7" class="today">今天</th></tr><tr><th colspan="7" class="clear" style="display: none;">Clear</th></tr></tfoot></table></div><div class="datetimepicker-years" style="display: none;"><table class="table-condensed"><thead><tr><th class="prev" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-left"></span> </th><th colspan="5" class="switch">2010-2019</th><th class="next" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-right"></span> </th></tr></thead><tbody><tr><td colspan="7"><span class="year old">2009</span><span class="year">2010</span><span class="year">2011</span><span class="year">2012</span><span class="year">2013</span><span class="year">2014</span><span class="year">2015</span><span class="year">2016</span><span class="year active">2017</span><span class="year">2018</span><span class="year">2019</span><span class="year old">2020</span></td></tr></tbody><tfoot><tr><th colspan="7" class="today">今天</th></tr><tr><th colspan="7" class="clear" style="display: none;">Clear</th></tr></tfoot></table></div></div><div class="datetimepicker datetimepicker-dropdown-bottom-right dropdown-menu" style="left: 96px; z-index: 10029;"><div class="datetimepicker-minutes" style="display: none;"><table class=" table-condensed"><thead><tr><th class="prev" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-left"></span> </th><th colspan="5" class="switch">21 四月 2017</th><th class="next" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-right"></span> </th></tr></thead><tbody><tr><td colspan="7"><span class="minute">13:00</span><span class="minute">13:05</span><span class="minute">13:10</span><span class="minute">13:15</span><span class="minute">13:20</span><span class="minute">13:25</span><span class="minute">13:30</span><span class="minute">13:35</span><span class="minute">13:40</span><span class="minute">13:45</span><span class="minute active">13:50</span><span class="minute">13:55</span></td></tr></tbody><tfoot><tr><th colspan="7" class="today">今天</th></tr><tr><th colspan="7" class="clear" style="display: none;">Clear</th></tr></tfoot></table></div><div class="datetimepicker-hours" style="display: none;"><table class=" table-condensed"><thead><tr><th class="prev" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-left"></span> </th><th colspan="5" class="switch">21 四月 2017</th><th class="next" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-right"></span> </th></tr></thead><tbody><tr><td colspan="7"><span class="hour">0:00</span><span class="hour">1:00</span><span class="hour">2:00</span><span class="hour">3:00</span><span class="hour">4:00</span><span class="hour">5:00</span><span class="hour">6:00</span><span class="hour">7:00</span><span class="hour">8:00</span><span class="hour">9:00</span><span class="hour">10:00</span><span class="hour">11:00</span><span class="hour">12:00</span><span class="hour active">13:00</span><span class="hour">14:00</span><span class="hour">15:00</span><span class="hour">16:00</span><span class="hour">17:00</span><span class="hour">18:00</span><span class="hour">19:00</span><span class="hour">20:00</span><span class="hour">21:00</span><span class="hour">22:00</span><span class="hour">23:00</span></td></tr></tbody><tfoot><tr><th colspan="7" class="today">今天</th></tr><tr><th colspan="7" class="clear" style="display: none;">Clear</th></tr></tfoot></table></div><div class="datetimepicker-days" style="display: block;"><table class=" table-condensed"><thead><tr><th class="prev" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-left"></span> </th><th colspan="5" class="switch">四月 2017</th><th class="next" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-right"></span> </th></tr><tr><th class="dow">日</th><th class="dow">一</th><th class="dow">二</th><th class="dow">三</th><th class="dow">四</th><th class="dow">五</th><th class="dow">六</th></tr></thead><tbody><tr><td class="day old">26</td><td class="day old">27</td><td class="day old">28</td><td class="day old">29</td><td class="day old">30</td><td class="day old">31</td><td class="day">1</td></tr><tr><td class="day">2</td><td class="day">3</td><td class="day">4</td><td class="day">5</td><td class="day">6</td><td class="day">7</td><td class="day">8</td></tr><tr><td class="day">9</td><td class="day">10</td><td class="day">11</td><td class="day">12</td><td class="day">13</td><td class="day">14</td><td class="day">15</td></tr><tr><td class="day">16</td><td class="day">17</td><td class="day">18</td><td class="day">19</td><td class="day">20</td><td class="day today active">21</td><td class="day">22</td></tr><tr><td class="day">23</td><td class="day">24</td><td class="day">25</td><td class="day">26</td><td class="day">27</td><td class="day">28</td><td class="day">29</td></tr><tr><td class="day">30</td><td class="day new">1</td><td class="day new">2</td><td class="day new">3</td><td class="day new">4</td><td class="day new">5</td><td class="day new">6</td></tr></tbody><tfoot><tr><th colspan="7" class="today">今天</th></tr><tr><th colspan="7" class="clear" style="display: none;">Clear</th></tr></tfoot></table></div><div class="datetimepicker-months" style="display: none;"><table class="table-condensed"><thead><tr><th class="prev" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-left"></span> </th><th colspan="5" class="switch">2017</th><th class="next" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-right"></span> </th></tr></thead><tbody><tr><td colspan="7"><span class="month">一月</span><span class="month">二月</span><span class="month">三月</span><span class="month active">四月</span><span class="month">五月</span><span class="month">六月</span><span class="month">七月</span><span class="month">八月</span><span class="month">九月</span><span class="month">十月</span><span class="month">十一月</span><span class="month">十二月</span></td></tr></tbody><tfoot><tr><th colspan="7" class="today">今天</th></tr><tr><th colspan="7" class="clear" style="display: none;">Clear</th></tr></tfoot></table></div><div class="datetimepicker-years" style="display: none;"><table class="table-condensed"><thead><tr><th class="prev" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-left"></span> </th><th colspan="5" class="switch">2010-2019</th><th class="next" style="visibility: visible;"><span class="glyphicon glyphicon-arrow-right"></span> </th></tr></thead><tbody><tr><td colspan="7"><span class="year old">2009</span><span class="year">2010</span><span class="year">2011</span><span class="year">2012</span><span class="year">2013</span><span class="year">2014</span><span class="year">2015</span><span class="year">2016</span><span class="year active">2017</span><span class="year">2018</span><span class="year">2019</span><span class="year old">2020</span></td></tr></tbody><tfoot><tr><th colspan="7" class="today">今天</th></tr><tr><th colspan="7" class="clear" style="display: none;">Clear</th></tr></tfoot></table></div></div><div><div id="maskLevel" style="position:absolute;top:0;left:0;display:none;text-align:center;z-index:10000;"></div><div id="ym-window" style="position:absolute;z-index:10001;display:none"><div class="ym-tl" id="ym-tl"><div class="ym-tr"><div class="ym-tc" style="cursor:move;"><div class="ym-header-text"></div><div class="ym-header-tools"><div class="ymPrompt_min" title="最小化"><strong>0</strong></div><div class="ymPrompt_max" title="最大化"><strong>1</strong></div><div class="ymPrompt_close" title="关闭"><strong>r</strong></div></div></div></div></div><div class="ym-ml" id="ym-ml"><div class="ym-mr"><div class="ym-mc"><div class="ym-body" style="position:relative"></div></div></div></div><div class="ym-ml" id="ym-btnl"><div class="ym-mr"><div class="ym-btn"></div></div></div><div class="ym-bl" id="ym-bl"><div class="ym-br"><div class="ym-bc"></div></div></div></div></div>

 <script type="text/javascript">
   
   	function nmx() {
   		var name=document.getElementById('bh').value;
   		if(name==""){
   			alert("名字不能为空");
   			return
   		}else{
   			$.ajax({
   	            url:"add",
   	            data:{"name":name},
   	            type:'POST',
   	            success:function (data){
   	            	if(data!=null&&data.leng>0){
   	            		var hbclList = data.drug;
   	            		var leng=data.leng;
   	            		 if(leng==1){
   	            			 	var mcid=hbclList[0].id;
   					    		var kcsl=hbclList[0].tory;
   					    		var yppfj=hbclList[0].p_price;
   					    		var ph=hbclList[0].batch;
   					    		var ypmc=hbclList[0].name;
   					    		var cd=hbclList[0].region;
   					    		var pzwh=hbclList[0].id;
   					    		var gg=hbclList[0].spec;
   					    		var yplsj=hbclList[0].price;
   					    		var fph="";
   					    		var dw=hbclList[0].unit;
   					    		var ypjhj=hbclList[0].p_price;
   					    		var sxrq=hbclList[0].yx_date;
   					    		var ggid=hbclList[0].jb;
   					    		var pc=hbclList[0].batch;
   					    		var aid=hbclList[0].jb;
   					    		var jcl=hbclList[0].jb;//加成率
   					    		var yplb=hbclList[0].jb;
   					    		var jglb=hbclList[0].jb; 
   					    		getopendata(mcid,kcsl,yppfj,ph,ypmc,cd,pzwh,gg,yplsj,fph,dw,ypjhj,sxrq,ggid,pc,aid,jglb,jcl,yplb);
   	                     }else{
   	                    	 $.each(hbclList, function(index){
   									var item="<tr ><td>"+hbclList[index].id+"</td>"
   												+"<td>"+hbclList[index].name+"</td>"
   												+"<td style='color:#FF0000;'>"+hbclList[index].p_price+"</td>"
   												+"<td style='color:#FF0000;'>"+hbclList[index].price+"</td>"
   												+"<td>"+hbclList[index].batch+"</td>"
   												+"<td>"+hbclList[index].spec+"</td>"
   												+"<td>"+hbclList[index].unit+"</td>"
   												+"<td>"+hbclList[index].region+"</td>"
   												+"<td>"+hbclList[index].tory+"</td>"
   												+"<td>"+hbclList[index].jb+"</td>"
   												+"<input type='hidden' id='info_pzwh' name='info.pzwh' value='"+hbclList[index].id+"' ></input>"
   												+"<input type='hidden' id='info_sxrq' name='info_sxrq' value='"+hbclList[index].yx_date+"' ></input>"
   												+"<input type='hidden' id='info_ph' name='info.ph' value='"+hbclList[index].department_id+"' ></input>"
   												+"<input type='hidden' id='info_ypjhj' name='info.ypjhj' value='"+hbclList[index].p_price+"' ></input>"
   												+"<input type='hidden' id='info_ggid' name='info.ggid' value='"+hbclList[index].id+"' ></input>"
   												+"<input type='hidden' id='info_aid' name='info.aid' value='"+hbclList[index].id+"' ></input>"
   												+"<input type='hidden' id='info_jcl' name='info.jcl' value='"+hbclList[index].name+"' ></input>"
   												+"<input type='hidden' id='info_yplb' name='info.yplb' value='"+hbclList[index].name+"' ></input>"
   												+"</tr>";
   												$("#tabc").append(item);
   									}); 
   									$("#tabc>tr").eq("0").addClass("select-focus");
   							    	$("#tabc>tr").dblclick(function() { 
   							    		var mcid=this.childNodes[0].innerHTML;
   							    		var kcsl=this.childNodes[8].innerHTML;
   							    		var yppfj=$($(this).find(":input").eq(3)).val();
   							    		var ph=$($(this).find(":input").eq(2)).val();
   							    		var ypmc=this.childNodes[1].innerHTML;
   							    		var cd=this.childNodes[7].innerHTML;
   							    		var pzwh=$($(this).find(":input").eq(0)).val();
   							    		var gg=this.childNodes[5].innerHTML;
   							    		var yplsj=this.childNodes[3].innerHTML;
   							    		var fph="";
   							    		var dw=this.childNodes[6].innerHTML;
   							    		var ypjhj=this.childNodes[2].innerHTML;
   							    		var sxrq=$($(this).find(":input").eq(1)).val();
   							    		var ggid=$($(this).find(":input").eq(4)).val();
   							    		var pc=this.childNodes[4].innerHTML;
   							    		var aid=$($(this).find(":input").eq(5)).val();
   							    		var jcl=$($(this).find(":input").eq(6)).val();
   							    		var yplb=$($(this).find(":input").eq(7)).val();
   							    		var jglb=this.childNodes[9].innerHTML;
   							    		$("#myModal").modal("hide");
   							    		$("#tabc").find(".select-focus").removeClass("select-focus");
   							    		getopendata(mcid,kcsl,yppfj,ph,ypmc,cd,pzwh,gg,yplsj,fph,dw,ypjhj,sxrq,ggid,pc,aid,jglb,jcl,yplb);		    		
   								 	}); 
   								  $("#myModal").modal("show");
   								 
   	                     }
   	            	}else{
   	            		alert("没有搜索信息,请重新输入");
   	            	}
   	            },
   	 
   	        });
   	        return false;
   		}
   		
	}
   	
   	function getopendata(mcid,kcsl,yppfj,ph,ypmc,cd,pzwh,gg,yplsj,fph,dw,ypjhj,sxrq,ggid,pc,aid,jglb,jcl,yplb){
		document.getElementById("bh").value=mcid;
		document.getElementById("info_kcsl").value=kcsl;
		document.getElementById("info_yppfj").value=yppfj;
		document.getElementById("info_ph").value=ph;
		document.getElementById("info_ypmc").value=ypmc;
		document.getElementById("info_cd").value=cd;
		document.getElementById("info_pzwh").value=pzwh;
		document.getElementById("info_gg").value=gg;
		document.getElementById("info_yplsj").value=yplsj;
		document.getElementById("info_fph").value=fph;
		document.getElementById("info_dw").value=dw;
		document.getElementById("info_ypjhj").value=ypjhj;
		document.getElementById("info_sxrq").value=sxrq;
		document.getElementById("info_ggid").value=ggid;
		document.getElementById("info_pc").value=pc;
		document.getElementById("info_aid").value=aid;
		document.getElementById("info_jglb").value=jglb;
		document.getElementById("info_jcl").value=jcl; 
		document.getElementById("yplb").value=yplb;  
		if(yplb=="3"){
			$("#unit_rcsl").attr("onkeyup",'ZNSRSZBXZ(this)'); 
		} 
		document.getElementById("ypjhj").value=ypjhj; 
		if(jglb=="顺差作价"){ 
			$("#info_yplsj").removeAttr("readonly");
			$("#info_ypjhj").attr("onblur",'JhjOnblur()');
		}else{ 
			$("#info_yplsj").attr("readonly",'readonly');
			$("#info_ypjhj").removeAttr("onkeydown");
			$("#info_ypjhj").attr("onkeydown","if(event.keyCode==13)Jhjfocus('info_cd')");
		}
		$("#unit_rcsl").focus();
		$("#table_tr").scrollTop(0);
	}
   	
   	function shouqi() {
		if (table2.style.display =="none") {
			document.getElementById("shouqitianjia").innerText = "隐藏明细";
			document.getElementById("table2").style.display = "block";
		} else {
			document.getElementById("shouqitianjia").innerText = "添加明细";
			document.getElementById("table2").style.display = "none";
		}
	}
   	
   	function BZHCSJ()
    {   
 	   setTimeout('querk()',200); 
    }
   	
   	function zj(){
   		var objdjbh,jhl,jhj,yxq,cd,fph,bz,ghdw,jbry,sdrq;
   		objdjbh =$("#djbh").val();
   		jhl =$("#unit_rcsl").val();//进货量
   		jhj =$("#info_ypjhj").val();//进货价
   		yxq =$("#info_sxrq").val(); //有效期
   		cd=$("#info_cd").val();//产地
   		fph =$("#info.fph").val();//发票号
   		bz =$("#info_bz").val(); //备注
   		ghdw =$("#unit_gysid").val();//供货单位
   		jbry =$("#jbry").val();//经办人员
   		sdrq =$("#unit_rcrq").val();//入库以及收到日期
   		
   		
   			if(jhl<=0&&jhl==""){
   				alert("进货量无效,请重新输入");
   				return
   			}else if(jhj<=0&&jhj==""){
   				alert("进货价无效,请重新输入");
				return
			}else if(cd==""){
				alert("产地无效,请重新输入");
   				return
			}else if(yxq==""){
				alert("有效期无效,请重新输入");
   				return
			}else if(fph==""){
				alert("票号无效,请重新输入");
   				return
			}else if(bz==""){
				alert("备注无效,请重新输入");
   				return
			}else{
				var sj = $('#infoform').serialize();
   	   		 	
   	   		 	//$.post("addzj",sj,function(){
   	   		 		//console.log(1111);
   	   		 	// });
   	   		 $.ajax({
   	            url:"addzj",
   	            data:sj,
   	            type:'POST',
   	            success:function (data) {
   	            	alert("增加成功");
   	            	location.reload(); 
   	            	return
   	            	
   	            },
   	          
   	        });
   	        return false;
			}
  
   	}
   	
   	function sc(id){
   		location ="delete?"+"id="+id;
   	}
   	
   	
   	
   </script>
</body></html>